home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9221 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  837 b 

  1. Path: taco.cc.ncsu.edu!jkhammon
  2. From: jkhammon@unity.ncsu.edu (John Kirk Hammond)
  3. Newsgroups: comp.lang.c++
  4. Subject: How does the c++ compiler handle references?
  5. Date: 29 Feb 1996 07:42:25 GMT
  6. Organization: North Carolina State University
  7. Sender: jkhammon@eos.ncsu.edu
  8. Message-ID: <4h3ld1$jd1@taco.cc.ncsu.edu>
  9. NNTP-Posting-Host: c00964-100lez.eos.ncsu.edu
  10.  
  11.     Just kinda curious...
  12.  
  13.     How does the c++ handle functions whose parameters are
  14. passed by reference?
  15.  
  16. i.e.
  17.  
  18.     void test(short &hello)
  19.     {
  20.         hello++;
  21.     }
  22.     
  23.     void foo ()
  24.     {
  25.         short hello = 0;
  26.         test(hello);
  27.     }
  28.  
  29.     Does the compiler do some sort of funky pointer weirdness?
  30. Like sending the address of hello instead of the value to test and
  31. casting the short parameter in test to a short *?  And then
  32. treating all uses of the variable hello in test as the dereferenced
  33. pointer?
  34.  
  35. -kirk
  36.  
  37.  
  38.